﻿namespace KinonekoSoftware.CodariaDB.Documents.DataParts.Modules
{
    public enum NumericStyle
    {
        Progress,
        Degree,
        Radar,
    }

    public sealed class Block_Numeric : ModuleBlock
    {
        public required List<Element_Numeric> Items { get; set; }

        public int          Maximum        { get; set; }
        public int          Minimum        { get; set; }
        public NumericStyle Style          { get; set; }
        public bool         UseGlobalRange => Style == NumericStyle.Radar;

        public static Block_Numeric CreateInstance(NumericStyle style) => new Block_Numeric
        {
            Id          = ID.Get(),
            Title       = "数字设定分组",
            Description = "用来实现固定颜色值",
            Maximum     = 10,
            Minimum     = 0,
            Style       = style,
            Items = new List<Element_Numeric>
            {
                new Element_Numeric { Id = ID.Get(), Title = "血量", Value = 3, Color = "#808000" },
                new Element_Numeric { Id = ID.Get(), Title = "攻击", Value = 4, Color = "#ff7f50" },
                new Element_Numeric { Id = ID.Get(), Title = "耐力", Value = 5, Color = "#6495ed" },
                new Element_Numeric { Id = ID.Get(), Title = "速度", Value = 6, Color = "#dc143c" },
                new Element_Numeric { Id = ID.Get(), Title = "防御", Value = 7, Color = "#9370db" },
            },
        };



        public override ModuleBlock Clone() => new Block_Numeric
        {
            Id          = Id,
            Title       = Title,
            Maximum     = Maximum,
            Minimum     = Minimum,
            Style       = Style,
            Description = Description,
            Items       = Items.Select(x => (Element_Numeric)x.Clone()).ToList(),
        };
    }
}